pub compile_opts: ops::CompileOptions<'a>,
}
-pub fn doc(ws: &Workspace,
- options: &DocOptions) -> CargoResult<()> {
+pub fn doc(ws: &Workspace, options: &DocOptions) -> CargoResult<()> {
let package = try!(ws.current());
let mut lib_names = HashSet::new();
bail!("Passing multiple packages and `open` is not supported")
} else if options.compile_opts.spec.len() == 1 {
try!(PackageIdSpec::parse(&options.compile_opts.spec[0]))
- .name().replace("-", "_")
+ .name()
+ .replace("-", "_")
} else {
match lib_names.iter().chain(bin_names.iter()).nth(0) {
Some(s) => s.to_string(),
- None => return Ok(())
+ None => return Ok(()),
}
};
if let Ok(name) = env::var("BROWSER") {
match Command::new(name).arg(path).status() {
Ok(_) => return Ok("$BROWSER"),
- Err(_) => methods.push("$BROWSER")
+ Err(_) => methods.push("$BROWSER"),
}
}
for m in ["xdg-open", "gnome-open", "kde-open"].iter() {
match Command::new(m).arg(path).status() {
Ok(_) => return Ok(m),
- Err(_) => methods.push(m)
+ Err(_) => methods.push(m),
}
}
fn open_docs(path: &Path) -> Result<&'static str, Vec<&'static str>> {
match Command::new("cmd").arg("/C").arg(path).status() {
Ok(_) => return Ok("cmd /C"),
- Err(_) => return Err(vec!["cmd /C"])
+ Err(_) => return Err(vec!["cmd /C"]),
};
}
fn open_docs(path: &Path) -> Result<&'static str, Vec<&'static str>> {
match Command::new("open").arg(path).status() {
Ok(_) => return Ok("open"),
- Err(_) => return Err(vec!["open"])
+ Err(_) => return Err(vec!["open"]),
};
}